#-*- encoding: gb2312 -*-  
import os
import sys  
reload(sys)   
sys.setdefaultencoding('gb2312')
import types

# find files in rootdir by key
# return type : list
def findFiles(rootdir):
	fs = []
	for path, dirs, files in os.walk(rootdir):
		if rootdir != path:
			fs.extend([path + '/' + os.listdir(path)[0]])
			
	for i in os.listdir(rootdir):
		if i.find('.doc') > 0:
			fs.extend([rootdir + i])
	
	return fs
	
if __name__ == "__main__":
	# test case of my main method
	fs = findFiles("C:/test/")
	
	for i in fs:
		print i